#ifdef __cplusplus
    #include <cstdlib>
#else
    #include <stdlib.h>
#endif

#include <SDL/SDL.h>
#include "SDL/SDL_Image.h"
#include "PNG_MainMenu.h"
#include "PNG_game.h"

int screenx=1280, screeny=720;

int main ( int argc, char** argv )
{
    //variable pour stocker le mode du jeux menu principale, jeu a un joueur, jeu a deux joueurs, etc...
    char mode='m';
    // initialize SDL video
    if ( SDL_Init( SDL_INIT_VIDEO ) < 0 )
    {
        printf( "Unable to init SDL: %s\n", SDL_GetError() );
        return 1;
    }

    // make sure SDL cleans up before exit
    atexit(SDL_Quit);

    // create a new window
    //SDL_FULLSCREEN|
    SDL_Surface* screen = SDL_SetVideoMode(screenx, screeny, 16,
                                           SDL_HWSURFACE|SDL_DOUBLEBUF);
    if ( !screen )
    {
        printf("Unable to set 640x480 video: %s\n", SDL_GetError());
        return 1;
    }

    // program main loop
    int done = 0;
    while (!done)
    {
        switch (mode){
        case 'm':
            mode=PNG_MainMenu(screen);
            break;
        case 'q':
            done=1;
            break;
        case 'n':
            mode=PNG_Game(screen);
            break;
        }
    } // end main loop

    // all is well ;)
    printf("Exited cleanly\n");
    return 0;
}
